package cn.aitrox.ry.service.auth.dao.impl;

import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.auth.dao.AuthPermissionDao;
import cn.aitrox.ry.service.auth.entity.AuthPermissionEntity;
import cn.aitrox.ry.service.auth.mapper.AuthPermissionMapper;
import cn.aitrox.ry.service.auth.po.permission.RolePermissionParamPo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class AuthPermissionDaoImpl extends BaseDaoImpl<AuthPermissionEntity> implements AuthPermissionDao {

    @Autowired
    private AuthPermissionMapper mapper;

    @Override
    public PageInfo<AuthPermissionEntity> searchByParam(Integer page, Integer pageSize, RolePermissionParamPo rolePermissionParamPo) {
        return super.searchByCustom(page, pageSize, new MapperSqlCallback<AuthPermissionEntity>() {
            @Override
            public List<AuthPermissionEntity> invoke() {
                return mapper.query(rolePermissionParamPo);
            }
        });
    }
}
